import java.util.Scanner;

public class LanQiaoPracticeGoodNum {

    public static void main(String[] args) {
        long l = System.currentTimeMillis();
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int ret = 0;
        for (int i = 1; i < n; i++) {
            if(isGoodNumber(i)){
                ret++;
            }
        }
        System.out.println(ret);
        long t = System.currentTimeMillis();
        System.out.println(t - l);
    }

    private static boolean isGoodNumber(int i) {
        int pos = 1;
        while(i > 0){
            if(pos % 2 == 1){
                int x = i % 10;
                if(x % 2 != 1){
                    return false;
                }
                i /= 10;
                pos++;
            }else {
                int x = i % 10;
                if(x % 2 != 0){
                    return false;
                }
                i /= 10;
                pos++;
            }
        }
        return true;
    }
}
